<div class="main">
    <div class="main-nav fl">
        <ul class="nave nav-tabs container">
            <li><a href="/task">任务大厅</a></li>
            <li class="smission.html"><a href="">我的任务</a></li>
            <li class="active"><a href="javascript:void(0)">绑定店铺</a></li>
            <li class="rela"><a href="/task/tasktemplate">发布任务</a></li>
        </ul>
    </div>
    <div class="order-wrap container hid">
        <ul class="nave nav-tabs order-nav">
            <li><a href="/task/bindtb" id="progressing">淘宝店铺</a></li>
            <li><a href="/task/bindjd" id="progressing">京东店铺</a></li>
            <li><a href="/task/bindrest" id="progressing">其他店铺</a></li>
            <li class="active"><a href="javascript:void(0)">店铺列表</a></li>
        </ul>
        <div class="tab-content fl">
            <div class="data-table data-tablen">
                <table>
                    <thead>
                    <tr>
                        <th>绑定店铺</th>
                        <th>绑定时间</th>
                        <th>掌柜名称</th>
                        <th>店铺名称</th>
                        <th>发布数量</th>
                        <th>店铺状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($shopList as $k=>$s){ ?>
                    <tr>
                        <td>
                            <?php if($s->shop_type==1){ ?>淘宝店铺<?php }elseif($s->shop_type==2){ ?>京东店铺<?php } ?>
                        </td>
                        <td><?php echo date("Y-m-d",$s->shop_time); ?></td>
                        <td><?php echo $s->shop_keeper; ?></td>
                        <td><?php echo $s->shop_name; ?></td>
                        <td><?php echo $shopNum[$k]; ?></td>
                        <td><?php if($s->shop_status==1){ ?>正常<?php }elseif($s->shop_status==2){ ?>禁用<?php } ?></td>
                        <td>
                            <?php if($s->shop_status==1){ ?>
                            <a class="btn btn-mini btn-red" href="javascript:void(0)" onclick="shopOperate(<?php echo $s->shop_id ?>,2)">禁用</a>
                            <?php }elseif($s->shop_status==2){ ?>
                            <a class="btn btn-mini btn-red" href="javascript:void(0)" onclick="shopOperate(<?php echo $s->shop_id ?>,1)">启用</a>
                            <?php } ?>
                        </td>
                    </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function shopOperate(id,v){
        $.ajax({
            url:"/ajax/shopoperate",
            type:"POST",
            data:{id:id,v:v},
            dataType:"json",
            success:function(result){
                if(result.status==1){
                    alert(result.msg);
                    location.href="/task/shoplist";
                }else{
                    alert(result.msg);
                }
            }
        });
    }
</script>